﻿@model IEnumerable<HopNguyenModel.Image>
@{
    ViewBag.Title = "Quản lý hình ảnh";
    Layout = "~/Views/Shared/_BackendLayout.cshtml";
}

<div class="page-header position-relative">
    <h1>Quản lý hình ảnh
    </h1>
</div>
<!--/.page-header-->
<div class="row-fluid">
    <div class="choose-type">
        <div class="span2">
            <a href="/Cpanel/CreateImage" class="btn btn-primary">Tạo mới</a>
        </div>
        <div class="span4">
            <strong>Lọc nhóm cha</strong> @Html.DropDownList("TypeId", null, "[No filter]", new { onchange = "typeidchange(this.value)" })
        </div>
    </div>
</div>
<div class="row-fluid">
    <table id="sample-table-2" class="table table-striped table-bordered table-hover">
        <thead>
            <tr>
                <th>Mã</th>
                <th>Hình ảnh</th>
                <th>Link</th>
                <th>Loại hình ảnh</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                    <td>@item.Id</td>
                    <td>@(item.Image1 != null ? Html.Raw("<a href='/Cpanel/EditImage/" + item.Id + "'><img src=\"" + item.Image1 + "\" width='100px' height='80px'></a>") : Html.Raw(""))</td>
                    <td>@item.Link</td>
                    <td>@item.TypeImage.Name</td>
                    <td>
                        <a href="/Cpanel/EditImage/@item.Id" title="Sửa">Sửa</a> | 
                            <a href="/Cpanel/DeleteImage/@item.Id" onclick="javascript:return confirm('Are you sure?');" title="Xóa">Xóa</a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>

